package com.link2room.rodimus.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

/**
 * 监听器异步线程池配置
 * Created by LN on 2018/1/10
 */
@Configuration
@EnableAsync
public class ListenerExecutorConfig {
    @Bean("newMember")
    public Executor mySimpleAsync() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(30);
        executor.setMaxPoolSize(100);
        executor.setQueueCapacity(1000);
        executor.setThreadNamePrefix("NewMemberExecutor-");
        executor.initialize();
        return executor;
    }
}
